Uec3.SaleInvoiceOperationWin=Ext.extend(Ext.UecWindow,{
	constructor:function(config){
		this.getGrid();
		this.getPageContainer();
		config=Ext.apply(config||{},{items:[this.editForm,this.saleInvoiceItem_grid,this.readOnlyForm]});
		Uec3.SaleInvoiceOperationWin.superclass.constructor.call(this,config);
	},
	getGrid:function(){
		this.saleInvoiceItem_record_config=[
			{name : 'id',type : 'int'}, 
			{name : 'companyId',type : 'int'}, 
			{name : 'receivableCode',type : 'string'}, 
			{name : 'companyName',type : 'int'}, 
			{name : 'customerId',type : 'int'},
			{name : 'customerName',type : 'string'}, 
			{name : 'documentType',type : 'int'}, 
			{name : 'documentTypeName',type : 'string'}, 
			{name : 'saleInvoiceId',type : 'int'}, 
			{name : 'receivableId',type : 'int'}, 
			{name : 'receivable',type : 'double'}, 
			{name : 'receivableReceived',type : 'double'}, 
			{name : 'receivableUnReceived',type : 'double'}, 
			{name : 'received',type : 'double'}
		];
		this.saleInvoiceItem_record=Ext.data.Record.create(this.saleInvoiceItem_record_config);
		this.saleInvoiceItem_url_store=new Ext.data.JsonStore({
			url:Uec3.App.Constants.homeUrl+"/receivable/base!getReceivablesBycustomerId.do",
			root:'root',
			pruneModifiedRecords:true,
			fields:this.saleInvoiceItem_record
		});
		this.saleInvoiceItem_store=new Ext.data.JsonStore({	
	        root: "root",
	        baseParams:{saleInvoiceId:0},
	        url : Uec3.App.Constants.homeUrl+'/saleInvoiceItem/base!extList.do',
	        pruneModifiedRecords:true, 
	        fields:this.saleInvoiceItem_record
		});
		var saleInvoiceItem_cm = new Ext.grid.ColumnModel([new Ext.grid.RowNumberer(), 
			{
			header:'操作',
			width:50,
			xtype:'anchorcolumn',
			dataIndex : 'act',
			items:[{
					text:"删除",
					scope:this,
					permissionId:102,
					handler:this.funDelete
				}]
			},
			{header : '应收款凭证号',width : 90,css : 'background-color:#ddd;',dataIndex : 'receivableCode'}, 
			{header : '客户',width : 200,css : 'background-color:#ddd;',dataIndex : 'customerName'}, 
			{header : '单据类型',width : 75,css : 'background-color:#ddd;',dataIndex : 'documentTypeName'}, 
			{header : '应收款',width : 75,css : 'background-color:#ddd;',align:"right",dataIndex : 'receivable'}, 
			{header : '已收金额',width : 75,css : 'background-color:#ddd;',align:"right",dataIndex : 'receivableReceived'}, 
			{header : '未收金额',width : 75,css : 'background-color:#ddd;',align:"right",dataIndex : 'receivableUnReceived'}, 
			{header : '收款金额',width : 75,dataIndex : 'received',align:"right",
			editor:new Ext.form.NumberField({allowBlank: false,allowNegative: false, decimalPrecision:2})
		}]);
		this.saleInvoiceItem_grid=new Ext.grid.EditorGridPanel({
	        cm:saleInvoiceItem_cm,
			store : this.saleInvoiceItem_store,
			selModel : new Ext.grid.RowSelectionModel({moveEditorOnEnter : true}),
			iconCls : 'icon-grid',
			loadMask : {msg : '数据加载中...'},
			clicksToEdit:1,
			flex:1,
			tbar: [{
				text: "添加",
				iconCls:'icon-add',
				scope:this,
				handler: this.funAddItem
			}],
			stripeRows : true,
			autoScroll : true
		});		
	},
	funAddItem:function(){
		var customerId=this.editForm.getForm().findField("customerId").getValue();
		if(!customerId){
			Ext.Msg.alert("信息","请先选择客户");
			return false;
		}else{
			var records=this.saleInvoiceItem_grid.getStore().getRange();
			var ids=[]
			Ext.each(records,function(record){
				ids.push(record.data.receivableId);
			});
			var desktop =Uec3.App.getDesktop();   
			desktop.launchWindowByParam("saleInvoiceItem_add",{customerId:customerId,idsnot:ids,window:this}); 
		}
	},
	getPageContainer:function(){
		this.partner_combox=Uec3.App.fieldFactory.getPartnerCombo({hiddenName:'customerId',lookupCallBackEvents:["lookupChange"],grid:[2,3,2,3]},0);
		var codeOfSellerField=new Ext.form.TextField({xtype : 'textfield',name : 'codeOfSeller',grid:[4,3,4,3]});
		this.saleInvoice_documentType=Uec3.App.dictionary.getCombo("invoiceType",{hiddenName:"invoiceType",allowBlank:false,grid:[6,3,6,3]});
		var gmtActualReceiveField=new Ext.form.DateField({name : 'gmtActualReceive',allowBlank:false,format : 'Y-m-d H:i:s',grid:[8,3,8,3]});
    	this.editForm=new Ext.FormPanel({
    		frame:true,
    		layout:"uec3grid",
    		height:80,
    		layoutConfig:{
			    hGrid:[6,21,6,17,6,17,6,21],
			    vGrid:[40,20,40]
		    },
    		items:[
    			{xtype:'label',
    			 html:'收&nbsp;&nbsp;&nbsp;&nbsp;款&nbsp;&nbsp;&nbsp;&nbsp;单',
	             style:'text-align:center; font-weight:bold;font-size:24px;font-family:FangSong_GB2312',
	             grid:[3,1,6,1]
    			},
	    		{xtype:'label',text : '单据号:',style:{fontSize:'14px'},grid:[7,1,7,1]},
	    		{xtype : 'textfield',name : 'code',readOnly :true,style:{background:'#dddddd'},grid:[8,1,8,1]},
	    		{xtype:"label",html:'<hr color="#34A4E0" />',grid:[1,2,8,2]},
    			{xtype:'label',text:'客户:',grid:[1,3,1,3]},this.partner_combox,
    			{xtype:'label',text:'发票号:',grid:[3,3,3,3]},codeOfSellerField,
    			{xtype:'label',text:'发票类型:',grid:[5,3,5,3]},this.saleInvoice_documentType,
    			{xtype:'label',text:'收款日期:',grid:[7,3,7,3]},gmtActualReceiveField,
    			{xtype:"hidden",name:"id"}
    			
    		]
    	});
    	this.readOnlyForm=new Ext.FormPanel({
    		frame:true,
    		layout:'uec3grid',
    		height:35,
    		layoutConfig:{
    			hGrid:[7,10,6,10,6,10,6,10,6,10,6,10],
				vGrid:[100]
		    },
		    defaults:{readOnly : true},
    		items:[
    			{xtype:'label',text:"单据状态:"},{xtype : 'textfield',name : 'statusVarName',style:{background:'#dddddd'}},
    			{xtype : 'label',text : '创建人:'},{xtype : 'textfield',name : 'creatorName',style:{background:'#dddddd'}},
    			{xtype : 'label',text : '创建时间:'},{xtype : 'textfield',name : 'gmtCreate',format : 'Y-m-d',style:{background:'#dddddd'}},
    			{xtype : 'label',text : '提交人:'},{xtype : 'textfield',name : 'receiverName',style:{background:'#dddddd'}},
    			{xtype : 'label',text : '提交时间:'},{xtype : 'textfield',name : 'gmtReceive',format : 'Y-m-d',style:{background:'#dddddd'}},
    			{xtype : 'label',text : '支付金额:'},{xtype : 'textfield',name : 'amount',style:{background:'#dddddd'}}
    		]
    	});
	},
	funDelete:function(grid, rowIndex, colIndex, item, e){
		var store=this.saleInvoiceItem_store;
		var record=store.getAt(rowIndex);
		store.remove(record);
	},
	initEvents:function(){
		Uec3.SaleInvoiceOperationWin.superclass.initEvents.call(this);
		this.ajax=Uec3.App.Uec3Ajax;
		this.buttonAjax=Uec3.App.Uec3Ajax;
		this.partner_combox.on("select",this.partComboEvent,this);
		this.partner_combox.on("lookupChange",this.partComboEvent,this);
		Ext.util.Observable.capture(this.editForm.getForm(),function(e,form,action){
			if(e=='beforeaction'){
				Ext.MessageBox.show({
	                title : "提示",
	                msg : "传输中,请稍后.....",
	                buttons: false,
	                closable:false,
	                width:200,
	                wait:true,
	                modal:true
	            });
			}else if(e=='actionfailed'){
				Ext.MessageBox.hide();
				Ext.Msg.alert("警告",'表单加载失败,网络延迟或断网,请稍后重写打开');
			}
		});	 
		Ext.util.Observable.capture(this.saleInvoiceItem_store,function(e){
	        if(e=='add'||e=='remove'||e=='update'||e=='load'){
	        	this.calAmount();
	        }
		},this);
		Ext.util.Observable.capture(this.saleInvoiceItem_grid.getView(),function(e,view,b,c){
	        if(e=='refresh'){
	        	if(this.isGridMask==true){
	        		this.gridBodyloadMark.show();
	        	}
	        }
		},this);
		this.saleInvoiceItem_grid.on('afteredit',function(o){
			var column=this.saleInvoiceItem_grid.getColumnModel().findColumnIndex('received');
			if(column==o.column){
				var record=o.record;
				var unReceived=record.get('unReceived');
				if(unReceived<o.value){
					record.set('received',unReceived);
				}
			}
		},this);
		this.on("show",this.fEAfterShow,this,{single:true});
		
		this.saleInvoiceItem_grid.on('afteredit',function(o){
			var record=o.record;
			var receivableUnReceived=record.get('receivableUnReceived');
			if(receivableUnReceived<o.value){
				record.set('received',receivableUnReceived);
			}
		});
	},
    /*新建单据*/
	saleInvoiceNew:function(btn){
		this.redirectUrl("saleInvoice_operation");
	},
	/*接手单据*/
    saleInvoiceRecieve:function(btn){
    	var _this=this;
    	this.ajax.request({
    		url:Uec3.App.Constants.homeUrl+'/saleInvoice/base!getSaleInvoiceById.do',
			params:{id:this.saleInvoice.id},
			scope:this,
			success:function(res,action){
				var result=Ext.decode(res.responseText);
				this.saleInvoice=result.data;
				this.useId=result.useId;
				if(!Ext.isEmpty(this.saleInvoice.currentorId)){
					Ext.Msg.confirm("提示",this.saleInvoice.currentorName+"在处理,确定要接手?",function(btn2){
						if(btn2=="yes"){
							this.formSubmit(btn.url,function(form,action){
							_this.buttonAjaxRequest("currentorModify",function(){
								Ext.Msg.alert("信息","接收单据成功");
								Ext.Msg.hide.defer(700,Ext.Msg);
								});
							});
						}
					},this);
				}else{
					this.formSubmit(btn.url,function(form,action){
						_this.buttonAjaxRequest("currentorModify",function(){
							Ext.Msg.alert("信息","接收单据成功");
							Ext.Msg.hide.defer(700,Ext.Msg);
						});
					});
				}
			}
    	});
	},
	/*释放单据*/
	saleInvoiceRelease:function(btn){
		var _this=this;
		var fn=function(form,action){
			var result=action.result;
			_this.saleInvoice=result.data;
			_this.buttonAjaxRequest("notCurModify",function(){
				Ext.Msg.alert("信息","释放单据成功");
				Ext.Msg.hide.defer(700,Ext.Msg);
			});
		}
		this.formSubmit(btn.url,fn);
	},
	/*saleInvoiceReset:function(){
		Ext.Msg.confirm("提示","确定置空所有的行",function(btn){
			if(btn=="yes"){
				initialFormPanel.getForm().reset();
				formSubmit("/initialItem/base!delByInitialId?initialId="+id,function(){
					ds_initialItem.reload();
		        });
			}
		});
	}*/
	/*查看付款单列表*/
	saleInvoiceView:function(){
		this.redirectUrl("saleInvoice_index");
	},
	refreshSaleInvoiceIndex:function(){
		var window =Uec3.App.getDesktop().getWindowByUecId("saleInvoice_index");   
		if(window){
			var store=window.moduleObj.getObjByKey('store');
			store.reload();
		}   		
	},
	refreshReceivableIndex:function(){
		var window =Uec3.App.getDesktop().getWindowByUecId("receivable_index");   
		if(window){
			var store=window.moduleObj.getObjByKey('store');
			store.reload();
		}   		
	},
	redirectUrl:function(id,params){
		var desktop =Uec3.App.getDesktop();   
		desktop.launchWindowByParam(id,params); 
	
	},
	formSubmit:function(url,fn){
		var result;
		this.partner_combox.enable();
		var saleInvoiceJson=Ext.encode(encodeFilte(this.editForm.getForm().getValues()));
		var saleInvoiceItems=[];
		Ext.each(this.saleInvoiceItem_grid.getStore().getRange(),function(record){
			saleInvoiceItems.push(record.data);
		});
		var saleInvoiceItemsJson=Ext.encode(encodeFilte(saleInvoiceItems));
		this.editForm.form.submit({
			url:url,
	        params:{'saleInvoiceJson':saleInvoiceJson,'saleInvoiceItemsJson':saleInvoiceItemsJson},
	        scope:this,
	        success:function(form,action){
		        result=action.result;
	      		if(result.success=='OK'){
	      			var saleInvoice=result.saleInvoice;
	      			var id=this.editForm.getForm().findField("id").getValue();
	      			if((!id||id=="")&&saleInvoice){
	      				this.changeWindowUecId(saleInvoice.code,saleInvoice.id);
	      			}
	      			if(saleInvoice)this.updateBasicForm(saleInvoice);
	      			if(result.saleInvoiceItemList){
						var store=this.saleInvoiceItem_grid.getStore();
						Ext.each(result.saleInvoiceItemList,function(saleInvoiceItem){
							Ext.each(store.getRange(),function(payable){							
								if(saleInvoiceItem.payableId==payable.data.payableId){
									payable.set("id",saleInvoiceItem.id);
								}
							});
						});
					}
	      			if(result.userId)this.userId=result.userId;
		  			if(Ext.isFunction(fn))fn(form,action);
		  		}else{
		  			Ext.Msg.alert('信息',result.success); 
		  		}
	       	},
	        failure:function(form,action){
	        	Ext.Msg.alert('提示','网络问题,操作失败!');
	      	}
		});
		return result;
	},
	/*保存*/
	saleInvoiceSave:function(btn){
		var _this=this;
		this.saveOrSubmit(btn,function(from,action){
			//this.refreshSaleInvoiceIndex();
			_this.buttonAjaxRequest("currentorModify");
			Ext.Msg.alert('提示','保存成功');
		});	
	},
	/*提交*/
	saleInvoiceSubmit:function(btn){
		var _this=this;
		this.saveOrSubmit(btn,function(){
			_this.buttonAjaxRequest("formal");
			//this.refreshSaleInvoiceIndex();
   			//this.refreshReceivableIndex();
			Ext.Msg.alert('提示','提交成功');
		});
	},
	saveOrSubmit:function(btn,fn){
		if(this.editForm.getForm().isValid()){
			var itemGridV=this.isItemGridValid();
			if(itemGridV[0]){
				this.formSubmit(btn.url,function(form,action){
					if(Ext.isFunction(fn))fn(form,action);	
				});
			}else{
				Ext.Msg.alert('提示',itemGridV[1]);
			}
		}else{
			Ext.Msg.alert('提示','请填写必填项');
		}
	},
	/*删除*/
	saleInvoiceDelete:function(btn){
		var _this=this;
		Ext.Msg.confirm("提示","确定删除",function(btn2){
			if(btn2=="yes"){
			    _this.formSubmit(btn.url,function(){
			    	_this.saleInvoiceClose();
			    	//_this.refreshSaleInvoiceIndex();
			    	Ext.Msg.alert('提示','删除成功');
			    	Ext.Msg.hide.defer(700,Ext.Msg);
			    });
			}
		});
	},
	/*打印*/
	payInvoicePrint:function(){
		
	},
	/*关闭*/
	saleInvoiceClose:function(){
		this.close();
	},
	updateBasicForm:function(saleInvoiceRet){
		if(saleInvoiceRet){
			this.editForm.getForm().setValues(saleInvoiceRet);
			this.saleInvoice=saleInvoiceRet;
		}
	},
	/*遮罩层*/
	isMark:function(typeId){
		this.isGridMask=false;
		var basicForm=this.editForm.getForm();
		basicForm.findField('codeOfSeller').enable();
		basicForm.findField('gmtActualReceive').enable();
		this.readOnlyForm.form.findField('amount').enable();
		this.partner_combox.enable();
		this.saleInvoice_documentType.enable();
		this.saleInvoiceItem_grid.getTopToolbar().enable();
		this.gridBodyloadMark.hide();
	 	if(typeId=='new'){
		}else if(typeId=='notCurModify'){
			this.gridBodyloadMark.show();
			this.isGridMask=true;
			basicForm.findField('codeOfSeller').disable();
			basicForm.findField('gmtActualReceive').disable();
			this.readOnlyForm.form.findField('amount').disable();
			this.saleInvoice_documentType.disable();
			this.partner_combox.disable();
			this.partner_combox.disabledClass="x-item-disabled-uec3";
			this.saleInvoiceItem_grid.getTopToolbar().disable();
		}else if(typeId=='currentorModify'){
			this.partner_combox.disable();
		}else if(typeId=='formal'){
			basicForm.findField('codeOfSeller').disable();
			basicForm.findField('gmtActualReceive').disable();
			this.readOnlyForm.form.findField('amount').disable();
			this.partner_combox.disable();
			this.saleInvoice_documentType.disable();
			this.saleInvoiceItem_grid.getTopToolbar().disable();
			this.gridBodyloadMark.show();
			this.isGridMask=true;
		}
	},
	partComboEvent:function(){
		var _this=this;
   		this.saleInvoiceItem_grid.getStore().removeAll();
   		var customerId=this.editForm.getForm().findField('customerId').getValue();
   		if(!Ext.isEmpty(customerId)){
       		this.saleInvoiceItem_url_store.load({params:{customerId:customerId,status:0},callback:function(){
	       		Ext.each(_this.saleInvoiceItem_url_store.getRange(),function(receivable){
	       			var record=_this.getSaleInvoiceItemRecord(receivable.data,0);
	       			_this.saleInvoiceItem_grid.getStore().add(record);
	       		});
     		}});
   		}
    },
    calAmount:function(){
		var records=this.saleInvoiceItem_store.getRange();
    	var amount=0;
    	Ext.each(records,function(record){
			amount+=record.get('received');	        	
    	});
    	this.readOnlyForm.getForm().setValues({'amount':amount})
	},
	//按钮加载
   	buttonAjaxRequest:function(typeId,fn){
   		this.buttonAjax.request({
		 	url:Uec3.App.Constants.homeUrl+'/saleInvoice/buttons.do',
		 	params:{typeId:typeId},
		 	scope:this,
		 	success:function(response,options){
		 		var reslut = Ext.decode(response.responseText);
		 		this.removeButtonPanel();
		 		this.addButtonPanel(reslut.buttons);// 初始按钮
		 		//是否遮罩
   				this.isMark(typeId);
   				if(Ext.isFunction(fn))fn(reslut);
		 	}
		});
   	},
   	getSaleInvoiceItemRecord:function(obj,type){
		//type:0表示从payable传过来的,1表示从saleInvoiceItem传过来的
		var recordType=this.saleInvoiceItem_record;
		var record=new recordType();
		if(type==0){
			record.set("receivableCode",obj.receivableCode);
			record.set("customerId",obj.customerId);
			record.set("customerName",obj.customerName);
			record.set("receivableId",obj.id);
			record.set("documentTypeName",obj.documentTypeName);
			record.set("receivable",obj.receivable);
			record.set("receivableReceived",obj.receivableReceived);
			record.set("receivableUnReceived",obj.receivableUnReceived);
			record.set("received",obj.receivableUnReceived);
		}else if(type==1){
			record.set("id",obj.id);
			record.set("receivableCode",obj.code);
			record.set("customerId",obj.customerId);
			record.set("customerName",obj.customerName);
			record.set("receivableId",obj.receivableId);
			record.set("documentTypeName",obj.documentTypeName);
			record.set("receivable",obj.receivable);
			record.set("receivableReceived",obj.receivableReceived);
			record.set("receivableUnReceived",obj.receivableUnReceived);
			record.set("received",obj.received);
		}
		return record;
	},
	isItemGridValid:function(){
   		var obj=this.editForm.form.getValues();
   		if(obj.id){
   			return [true];
   		}else{
   			if(this.saleInvoiceItem_grid.getStore().getCount()>0){
   				return [true];
   			}else{
   				return [false,"请至少加一条明细记录"];
   			}
   			var error=false;
   			Ext.each(this.saleInvoiceItem_grid.getStore().getRange(),function(record){
   				if(record.receivableUnReceived<received){
   					error=true;
   					return false;
   				}
   			});
   			if(error){
   				return [false,"明细中,收款数金额要小于未收款!"]
   			}
   		}
   		return [false];
   	},
   	show:function(){
   		Uec3.SaleInvoiceOperationWin.superclass.show.call(this);
   		var html=this.saleInvoiceItem_grid.getView().el.select(".x-grid3-body").elements[0];
		if(!this.gridBodyloadMark)this.gridBodyloadMark=new Ext.LoadMaskJUPIT(html);
   		
   	},
   	fEAfterShow:function(){
   		var params=this.params;
		if(params&&params.id){
			this.editForm.getForm().load({
				url:Uec3.App.Constants.homeUrl+'/saleInvoice/base!getSaleInvoiceById.do',
				params:{id:params.id},
				scope:this,
				success:function(form,action){
					if(action.result.success=='OK'){
	   					this.saleInvoice=action.result.data;
	   					this.userId=action.result.userId;
	   					this.changeWindowUecId(this.saleInvoice.code,this.saleInvoice,id);
	   					if(this.saleInvoice.status==0){
	   						if(this.saleInvoice.currentorId==this.userId){
	   							this.buttonAjaxRequest("currentorModify");
	   						}else{
	   							this.buttonAjaxRequest("notCurModify");
	   						}
	   					}else if(this.saleInvoice.status==1){
	   						this.buttonAjaxRequest("formal");
	   					}
						this.saleInvoiceItem_grid.getStore().baseParams={'saleInvoiceId':Ext.isEmpty(this.saleInvoice.id)?0:this.saleInvoice.id};
						this.saleInvoiceItem_grid.getStore().load();
	   					var partner=action.result.partner;
	   					if(partner){
							this.partner_combox.initializeValue({'name':partner.name,'pyCode':partner.pyCode,'id':partner.id});
						}
					}else{
						Ext.Msg.alert("错误",action.result.success);
					}
				},
				failure:function(){
	    			Ext.Msg.alert("警告",'网络延迟或断网,请稍后重写打开');
	    			this.saleInvoiceClose();
				}
			});
		}else if(params&&params.receivableIds){
			this.ajax.request({
				url:Uec3.App.Constants.homeUrl+'/saleInvoice/base!createFormReceivable.do',
				params:{receivableIds:params.receivableIds,customerId:params.customerId},
				scope:this,
				success:function(form,action){
					var result=Ext.decode(form.responseText);
					if(result.success=="OK"){
	   					var receivableList=result.receivableList;
	   					var partner=result.partner;
						if(partner){
							this.partner_combox.initializeValue({'name':partner.name,'pyCode':partner.pyCode,'id':partner.id});
						}
						if(receivableList.length>0){
							Ext.each(receivableList,function(receivable){
								var record=this.getSaleInvoiceItemRecord(receivable,0);
								this.saleInvoiceItem_grid.getStore().add(record);
							},this);
						}
						this.buttonAjaxRequest("new");
					}else{
						Ext.Msg.alert("错误",result.success);
						this.saleInvoiceClose();
					}
				},
				failure:function(){
	    			Ext.Msg.alert("网络错误",'加载付款单明细出错,请稍后重写打开');
	    			this.saleInvoiceClose();
				}
			});
		}else{
			this.buttonAjaxRequest("new");
		}
   	}
});
Uec3.saleInvoiceOperationWindow = Ext.extend(Ext.app.Module, {
    id: 'saleInvoice_operation',
    createWindow : function(params){
   	    var windowId=this.createWindowUectId(params.winId);
        var desktop = this.app.getDesktop(); 
        var win = desktop.getWindowByUecId(windowId);
        if(!win){
            win = desktop.createWindow({
            uecId: windowId,
            title: '收款单',
            width: 1000,
            height: 500,
            params:params,
            iconCls: 'acc-icon-saleInvoice',
            shim: false,
            moduleId:this.id,
            animCollapse: false,
            constrainHeader: true,
            maximizable: true,
            layout: "vbox",
            layoutConfig:{align:'stretch'}
            },Uec3.SaleInvoiceOperationWin);
        } 
        win.show();
   }
});

